// var examplearr = [8, 94, 15, 88, 55, 76, 21, 39];
// var examplearr = [3, 1, 4, 7, 8, 5, 10, 43, 12, 11];
var examplearr = [4, 1, 3, 7, 8, 2, 10, 43, 12, 11, 20, 6];

function sortarr(arr) {
    for (i = 0; i < arr.length - 1; i++) {
        for (j = 0; j < arr.length - 1 - i; j++) {
            if (arr[j] > arr[j + 1]) {
                var temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
    return arr;
}
sortarr(examplearr);
console.log(examplearr);